<%@ page import="com.situ.web.pojo.entity.Student" %>
<%@ page import="java.util.List" %>
<%@ page import="com.situ.web.pojo.vo.StudentBanjiVO" %><%--
  Created by IntelliJ IDEA.
  User: Gao
  Date: 2024/4/2
  Time: 11:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="static/bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
    <a class="btn btn-primary" href="/student?method=toAdd">添加</a>
    <table class="table table-striped table-bordered table-hover table-condensed">
        <tr>
            <td>ID</td>
            <td>名字</td>
            <td>年龄</td>
            <td>性别</td>
            <td>班级Id</td>
            <td>删除</td>
            <td>编辑</td>
        </tr>
        <c:forEach items="${list}" var="studentBanjiVO">
            <tr>
                <td>${studentBanjiVO.id}</td>
                <td>${studentBanjiVO.name}</td>
                <td>${studentBanjiVO.age}</td>
                <td>${studentBanjiVO.gender}</td>
                <td>${studentBanjiVO.banjiId}</td>
                <td>${studentBanjiVO.banjiName}</td>
                <td><a href="javascript:void(0)" onclick="deleteById(${studentBanjiVO.id})">删除</a></td>
                <td><a href="/student?method=toUpdate&id=${studentBanjiVO.id}">编辑</a></td>
            </tr>
        </c:forEach>
    </table>
    <script>
        function deleteById(id) {
            var isDelete = confirm('您确认要删除么?');
            if (isDelete) {
                location.href = '/student?method=deleteById&id=' + id;
            }
        }
    </script>
</body>
</html>
